/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020-11-3      Ghazigq       first version
 */

#ifndef __DRV_COMMON_H__
#define __DRV_COMMON_H__

#include <rtthread.h>
#include <rthw.h>
#include <board.h>

#ifdef __cplusplus
extern "C"
{
#endif

#include <board.h>
#include "nrf.h"
#include "nrfx.h"
#include "nrf_gpio.h"
#include "nrfx_uarte.h"
#include "nrfx_saadc.h"
#include "nrfx_rtc.h"
#include "nrfx_clock.h"
#include "nrfx_wdt.h"
#include "nrf_nvmc.h"
#include "nrfx_spim.h"
#include "nrfx_saadc.h"
#include "nrfx_usbd.h"


#ifdef __CC_ARM
extern int Image$$RW_IRAM1$$ZI$$Limit;
#define HEAP_BEGIN    (&Image$$RW_IRAM1$$ZI$$Limit)
#elif __ICCARM__
#pragma section="HEAP"
#define HEAP_BEGIN    (__segment_end("HEAP"))
#else
extern int __bss_end;
#define HEAP_BEGIN    (&__bss_end)
#endif

#define HEAP_END      RAM_END

#define GET_PIN(PORTx,PIN) (rt_base_t)NRF_GPIO_PIN_MAP(PORTx,PIN)

#ifdef __cplusplus
}
#endif

#endif
